%% This file is `cover.sty'
%% Copyright 2024 2025 Githubonline1396529
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008 or later.
%
% This work has the LPPL maintenance status `maintained'.
% 
% The Current Maintainer of this work is Githubonline1396529
%
% This work consists of the files cover.sty, dlmuucexprep.cls and
% logo.png

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{docfmt}[
  2025/03/18 Global format settings for all three document class in this%
  Project.
]

% 使用STXingkai华文行楷字体
\setCJKfamilyfont{hwxk}[Path=fonts/]{STXingkai.ttf} 
\newcommand{\huawenxingkai}{\CJKfamily{hwxk}}

\makeatletter
% 文档的信息
% 用于在封面上展示
\newcommand\college[1]{\def\@college{#1}}

\renewcommand{\title}[1]{\def\@title{#1}}

\newcommand\course[1]{\def\@course{#1}}
\newcommand\major[1]{\def\@major{#1}}
\newcommand\class[1]{\def\@class{#1}}
\newcommand\stuid[1]{\def\@stuid{#1}}
\newcommand\name[1]{\def\@name{#1}}
\newcommand\teacher[1]{\def\@teacher{#1}}

\renewcommand{\date}[1]{\def\@date{#1}}

% 设置元数据默认值
% 这部分内容将会被用于构建文档的封面
\college{大连海事大学}
\title{实验报告}

\course{某某专业实验课}
\major{某某专业}
\class{20XX-X班}
\stuid{2220XXXXXX}
\name{你的名字}
\teacher{你的老师}
\date{XXXX年XX月XX日}

% 设置页眉和页脚
\pagestyle{fancy}
\fancyhead{} % 仅清空页眉
\renewcommand{\headrulewidth}{0pt} % 去掉页眉的横线

% 出于封面样式的需要，将 ulem 的下划线设置为 1pt
\renewcommand{\ULthickness}{1pt} % 设置下划线厚度为 1pt

% 封面
\renewcommand{\maketitle}{
\begin{titlepage}
\thispagestyle{empty}

% 微调位置
\vspace*{12pt}

\begin{center}
    {\fontsize{42pt}{42pt}\huawenxingkai \@college\\[0em]}

    \vspace{1.2\baselineskip} % 微调行距

    {\fontsize{26pt}{26pt}\heiti \@title\\[0em]}

    \vspace{2.1\baselineskip} % 微调行距

    \includegraphics[width=5.67cm]{logo.png} % 插入 logo.png
\end{center}

\vspace*{32pt} % 一号字空一行

% 封面上的姓名课程等信息框
\begin{table}[H]
    \centering
    \setlength{\tabcolsep}{0pt} % 设置列距为0
    \setlength{\arrayrulewidth}{1pt} % 设置表格线条宽度
    \renewcommand{\arraystretch}{2.15} % 设置行距
    % \centering
    \fontsize{20pt}{20pt}\kaitigb
    \begin{tabular}{b{2.8875cm} b{9cm}<{\centering}}
        % 这里有几个要点：
        %     1. 使用 ulem 宏包的 `\uline` 命令可以很好地设置下划线
        %     2. 使用 `\parbox` 设置强制居中
        %     3. 使用 `\raisebox` 将字体与下划线之间的距离抬高一点
        \textbf{\bfseries 课程名称} & 
        \uline{\raisebox{0.5ex}{\parbox[c][\baselineskip][c]{9cm}%
        {\centering\textbf{\bfseries \@course}}}} \\
        \textbf{\bfseries 专\qquad 业} & 
        \uline{\raisebox{0.5ex}{\parbox[c][\baselineskip][c]{9cm}%
        {\centering\textbf{\bfseries \@major}}}} \\
        \textbf{\bfseries 班\qquad 级} & 
        \uline{\raisebox{0.5ex}{\parbox[c][\baselineskip][c]{9cm}%
        {\centering\textbf{\bfseries \@class}}}} \\
        \textbf{\bfseries 学\qquad 号} & 
        \uline{\raisebox{0.5ex}{\parbox[c][\baselineskip][c]{9cm}%
        {\centering\textbf{\bfseries \@stuid}}}} \\
        \textbf{\bfseries 姓\qquad 名} & 
        \uline{\raisebox{0.5ex}{\parbox[c][\baselineskip][c]{9cm}%
        {\centering\textbf{\bfseries \@name}}}} \\
        \textbf{\bfseries 指导教师} & 
        \uline{\raisebox{0.5ex}{\parbox[c][\baselineskip][c]{9cm}%
        {\centering\textbf{\bfseries \@teacher}}}} \\
    \end{tabular}
\end{table}

\vspace{0pt} % 微调行距

\begin{center}
    {
        \fontsize{22pt}{22pt}{\kaitigb\bfseries \@date\par}}
\end{center}
\newpage
\end{titlepage}
}

\makeatother
